GtkScrolledWindow: Always uninstall scroll cursor when starting deceleration
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 27 Jul 2016 18:19:30 +0000 (20:19 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 27 Jul 2016 18:28:23 +0000 (20:28 +0200)
It could be the case that the last scroll event is received long after any
previous scroll event, in this case the last scroll event discards all "old"
scroll events, and scroll_history_finish() returns FALSE because there's no
time/offset deltas in the scroll history.

This is desired so we don't trigger the deceleration effect if there was no
effective velocity, we still must reset the installed scroll cursor, so take
it out of this if() condition.

gtk/gtkscrolledwindow.c

index df7302c8f8c9e7fca41b04faf4a49815786a555d..17f25e015ac22605ba769767ee80f163c9e3de7b 100644 (file)
@@ -3503,12 +3503,12 @@ gtk_scrolled_window_scroll_event (GtkWidget      *widget,
           priv->scroll_events_overshoot_id = 0;
         }
 
+      if (start_deceleration)
+        uninstall_scroll_cursor (scrolled_window);
+
       if (start_deceleration &&
           scroll_history_finish (scrolled_window, &vel_x, &vel_y))
-        {
-          uninstall_scroll_cursor (scrolled_window);
-          gtk_scrolled_window_decelerate (scrolled_window, vel_x, vel_y);
-        }
+        gtk_scrolled_window_decelerate (scrolled_window, vel_x, vel_y);
       else if (_gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
         {
           priv->scroll_events_overshoot_id =